home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.5)
-
- import re
-
- def purify(data):
- return _process(data, 'purify', data)
-
-
- def scrape(data):
- return _process(data, 'scrape', '')
-
-
- def _process(data, fkey, default):
- if data is None:
- return ''
-
- processed = None
- for funcs in FUNCS:
- process = funcs[fkey]
- processed = process(data)
- if processed is not None:
- break
- continue
-
- if processed is None:
- processed = default
-
- return processed
-
- FEEDBURNER_AD_PATTERN = re.compile('\n <p> # <p>\n <a\\shref="http://feeds\\.feedburner\\.com/~a/[^"]*"> # <a href="...">\n <img\\ssrc="http://feeds\\.feedburner\\.com/~a/[^"]*"\\sborder="0"> # <img src="..." border="0">\n </img> # </img>\n </a> # </a>\n </p> # </p>\n ', re.VERBOSE)
-
- def _tryPurifyingFeedBurner(data):
- if FEEDBURNER_AD_PATTERN.search(data):
- return FEEDBURNER_AD_PATTERN.sub('', data)
-
-
-
- def _tryScrapingFeedBurner(data):
- match = FEEDBURNER_AD_PATTERN.search(data)
- if match is not None:
- return match.group(0)
-
-
- FUNCS = [
- {
- 'purify': _tryPurifyingFeedBurner,
- 'scrape': _tryScrapingFeedBurner }]
-